<template>
  <section class="section">
    <mu-appbar color="primary" class="lan-header">
      <mu-button icon slot="left" v-close>
        <i class="iconfont angle-left iconangle-left "></i>
        <span class="lan-header-back">返回</span>
      </mu-button>
      问题记录
    </mu-appbar>
    <!--检查记录详情-->
    <section class="content">
      <inspection_record_card2 @fetch="fetch"  v-bind:data='data' ></inspection_record_card2>
    </section>
  </section>
</template>

<script>
  import inspection_record_card2 from '../../QualityModule/parameter/task/components/InspectionRecordCards'

  export default {
    name: "problemDetails",
    data () {
      return {
        totalPage: 1,
        data: [],
        id: '',
        type:'',
        pageSize: 10,
        pageNo: 0,
      }
    },
    components: {
      inspection_record_card2//检查记录详情
    },
    props: {},
    mounted () {
      console.log(this.$route.query.info);
      this.id = this.$route.query.info;
      this.type = this.$route.query.type;
      this.fetch();
    },
    methods: {

      fetch () {

        if (this.pageNo >= this.totalPage) {
          // this.$closeLoading();
          return
        };
        this.pageNo += 1;

        this.$A.Go('get', '/safety/checkProblem/pageList', {
          checkTaskId: this.id,
          taskAndProblemAlarmType:this.type,
          orgId: this.$A.GS("orgInfo")["orgId"],
          type: this.$A.GS("orgInfo")["type"],
          current: this.pageNo,	//是	int		当前页
          size: this.pageSize,	//是	int		当前页大小
        }).then((success) => {
          if (success.code == 200) {
            let datas = success.body.rows;

            this.data = this.data.concat(datas);
            let total = success.body.page.rows || '0';
            this.totalPage = Math.ceil(total / this.pageSize);
          } else {
          }
        })
      }
    }
  }
</script>

<style scoped lang="scss">
  .section {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    .content {
      flex: 1;
      overflow: auto;
      padding: 0.1rem 0;
    }
  }
</style>
